package com.xhy.controller;


import com.xhy.entity.Category;
import com.xhy.service.ICategoryService;
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 分类 前端控制器
 * </p>
 *
 * @author xhy
 * @since 2022-08-30
 */
@RestController
@RequestMapping("/category")
@Slf4j
public class CategoryController {
    @Autowired
    private ICategoryService categoryService;
    @Autowired
    private RedissonClient redissonClient;
    @GetMapping("/selectOne/{id}")
    public Category selectById(@PathVariable("id") Integer id){

        return categoryService.getById(id);
    }
    @GetMapping("/categories")
    public List<Category> selectAll(){
        return categoryService.selectAllCate();
    }
}

